package com.zjl.cms.service;

import java.util.List;

import javax.servlet.ServletContext;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zjl.cms.dao.ConfigDao;
import com.zjl.cms.model.Config;
import com.zjl.cms.util.JsonUtil;

import net.sf.json.JSONObject;

@Service("configService")
public class ConfigService {

	@Autowired
	private ConfigDao configDao;

	public int getAllConfig(ServletContext servletContext) {
		List<Config> configList = configDao.getAllCongif();
		for (Config tmp : configList) {
			servletContext.setAttribute(tmp.getKey(), tmp.getValue());
		}
		return configList.size();
	}

}
